package com.riven.redisson.annotation;

import com.riven.redisson.concurrent.DistributedLockBeanDefinitionRegistrar;
import org.springframework.context.annotation.Import;
import org.springframework.core.Ordered;

import java.lang.annotation.*;

/**
 * @author riven
 * @since 2025-05-22
 */
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Import(DistributedLockBeanDefinitionRegistrar.class)
public @interface EnableDistributedLock {

    int INTERCEPTOR_PRECEDENCE = Ordered.HIGHEST_PRECEDENCE + 1000;

    String application() default "application";

    int order() default INTERCEPTOR_PRECEDENCE;

    /**
     * the max lock duration perform by the default lock provider {@link com.riven.redisson.concurrent.SetNxRedissonLockProvider}
     */
    long maxLockMillis() default 10000;

}
